#include <iostream>
#include <string>
#include "/home/k/work/PLCC/plcc/net/SocketAddr.h"

using namespace std;

int main() {
  SocketAddr addr;
  addr.SetFamily(AF_INET);
  addr.SetPort(88);
  try{
    addr.SetAddr("192.168.1.1");
  }catch (int a) {
    cout << "error "<<a << endl;
  }

  cout << "1: " << (addr.Family() == AF_INET)<< endl;
  cout << "2: " << addr.Port() << endl;
  cout << "3: " << addr.AddrToString() << endl;
  cout << "4: " << addr.Addr() << endl;
  
  SocketAddr addr1(AF_INET, 88, "192.168.1.11");
  cout << "1: " << (addr1.Family() == AF_INET)<< endl;
  cout << "2: " << addr1.Port() << endl;
  cout << "3: " << addr1.AddrToString() << endl;

  SocketAddr addr2(AF_INET, 88, 3232235787u);
  cout << "1: " << (addr2.Family() == AF_INET)<< endl;
  cout << "2: " << addr2.Port() << endl;
  cout << "3: " << addr2.AddrToString() << endl;
}
